package br.com.ovopoche.model.to;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

/**
 * Represents a theather and provides access to its movies and address.
 * 
 * @author rafael
 * 
 */
public class TheaterTO implements Serializable {

	/**
	 * The serial version UID.
	 */
	private static final long serialVersionUID = 7016467116294006041L;

	/** The theater's name. **/
	private String name;

	/** The address of the theater place. **/
	private String address;

	/** The movies that are being shown. **/
	private Collection<MovieTO> movies;

	/**
	 * Adds a movie to the current theater.
	 * 
	 * @param movieTO
	 *            the movie to be added.
	 */
	public void addMovie(MovieTO movieTO) {

		// Initialize the movies if they are null
		if (movies == null) {
			movies = new ArrayList<MovieTO>();
		}

		movies.add(movieTO);
	}

	/**
	 * @return the address
	 */
	public String getAddress() {
		return address;
	}

	/**
	 * @param address
	 *            the address to set
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * @return the movies
	 */
	public Collection<MovieTO> getMovies() {
		return movies;
	}

	/**
	 * @param movies
	 *            the movies to set
	 */
	public void setMovies(Collection<MovieTO> movies) {
		this.movies = movies;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "TheaterTO [name=" + name + ", address=" + address + ", movies="
				+ movies + "]";
	}

}
